package com.study.jdk.concurrent.schedule;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;

/**
 * Created by tan on 2017/8/3.
 */
public class ScheduleTest {
	public static void main(String[] args) throws InterruptedException {
		ScheduledExecutorService executorService = Executors.newScheduledThreadPool(8);
		ScheduledFuture future = executorService.schedule(new ScheduleTask(),0, TimeUnit.MILLISECONDS);

		Thread.sleep(1);

		boolean canceled = future.cancel(true);
		if(canceled){
			System.out.println(canceled);
			Thread.sleep(10000000);
		}


	}
}
